<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">
 
    <ui:composition>
        <p:dialog id="UsersEditDlg" widgetVar="UsersEditDialog" modal="true" resizable="false"  appendTo="@(body)" header="#{MyBundle.EditUsersTitle}" closeOnEscape="true">

            <h:form id="UsersEditForm"> 

                <h:panelGroup id="display">
                    <p:panelGrid  columns="2" columnClasses="column" rendered="#{usersController.selected != null}">

                        <h:outputLabel value="#{MyBundle.EditUsersLabel_user}" for="user" />
                        <h:outputText id="user" value="#{usersController.selected.user}" />

                        <p:outputLabel value="#{MyBundle.EditUsersLabel_password}" for="password" />
                        <p:inputText id="password" value="#{usersController.selected.password}" title="#{MyBundle.EditUsersTitle_password}" required="true" requiredMessage="#{MyBundle.EditUsersRequiredMessage_password}" size="10" maxlength="10"/>

                        <p:outputLabel value="#{MyBundle.EditUsersLabel_email}" for="email" />
                        <p:inputText id="email" value="#{usersController.selected.email}" title="#{MyBundle.EditUsersTitle_email}" required="true" requiredMessage="#{MyBundle.EditUsersRequiredMessage_email}" size="50" maxlength="50"/>
                        
                        <p:outputLabel value="#{MyBundle.CreateUsersLabel_superadmin}" for="superadmin" />
                        <p:selectOneMenu id="superadmin" value="#{usersController.selected.superadmin}" required="true" requiredMessage="#{MyBundle.CreateUsersRequiredMessage_superadmin}"> 
                            <f:selectItem itemLabel="N" itemValue="N"  />             
                            <f:selectItem itemLabel="Y" itemValue="Y"  />             
                        </p:selectOneMenu>
                       
                        <p:outputLabel value="#{MyBundle.CreateUsersLabel_status}" for="status" />
                        <p:selectOneMenu id="status" value="#{usersController.selected.status}" required="true" requiredMessage="#{MyBundle.CreateUsersRequiredMessage_status}">
                            <f:selectItem itemLabel="#{MyBundle.Active}" itemValue="Active"  />  
                            <f:selectItem itemLabel="#{MyBundle.Inactive}" itemValue="Inactive"  />  
                            <f:selectItem itemLabel="#{MyBundle.Connected}" itemValue="Connected"  />  
                        </p:selectOneMenu>
                        <!--
                         <p:outputLabel value="#{MyBundle.EditUsersLabel_lastConnection}" for="lastConnection" />
                         <p:calendar id="lastConnection" pattern="MM/dd/yyyy HH:mm:ss" value="#{usersController.selected.lastConnection}" title="#{MyBundle.EditUsersTitle_lastConnection}"  showOn="button"/>
                        -->
                    </p:panelGrid>
                    
                    <p:commandButton actionListener="#{usersController.save}" value="#{MyBundle.Save}" update="display,:UsersListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,UsersEditDialog);">
                        <p:confirm header="#{MyBundle.ConfirmationHeader}" message="#{MyBundle.ConfirmEditMessage}" icon="ui-icon-alert"/>
                    </p:commandButton>
                    
                    <p:commandButton value="#{MyBundle.Cancel}" onclick="UsersEditDialog.hide()"/>
                    
                </h:panelGroup>

            </h:form>

        </p:dialog>

    </ui:composition>

</html>
